package com.uinnova.springboot.demo.encache;

import com.uinnova.springboot.demo.kit.Retkit;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 张攀钦
 * @date 2018-12-25-23:04
 * ${DES}
 */
@RestController
@Api
public class CacheController {
    @Autowired
    private CacheService cacheService;

    @GetMapping(value = "/jail/cache/{id}")
    public Retkit getCache(@PathVariable String id) {
        return Retkit.ok().data(cacheService.getCache(id));
    }

    @GetMapping(value = "/jail/cachePut/{id}")
    public Retkit cachePut(@PathVariable String id) {
        return Retkit.ok().data(cacheService.cachePut(id));
    }

    @GetMapping(value = "/jail/cacheEvict/{id}")
    public Retkit cacheEvict(@PathVariable String id) {
        return Retkit.ok().data(cacheService.cacheEvict(id));
    }
}
